﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Tong.XmlHttp;
using System.Text.RegularExpressions;
public partial class aspnet_admin_bock_collect_CollectExe_testList : System.Web.UI.Page
{
    Tong.TongUse TextData = new Tong.TongUse();
    GetWebData webDate = new GetWebData(); 
    public string pageURL = "";//页面地址
    public string RegexStr1 = ""; //正则
    public string pagecode = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        Session.Timeout = 50;
        //测试数据
        try
        {
            string RegexStr="";
            pagecode = Request.QueryString["pagecode"].Trim();
            string Scont = "";
            pageURL = Request.QueryString["pageURL"].Trim();
            RegexStr1 = Request.QueryString["RegexStr"].Trim();
            
            RegexStr = RegexStrX(RegexStr1.Trim());
            urlx.Text = pageURL ;
            Scont = webDate.GetWebDate(pageURL, pagecode);
            Scont = Regex.Match(Scont, RegexStr).Value.ToLower();
            Session["ListPage"] = Scont.ToLower();

            TextBox1.Text = Session["ListPage"].ToString();
            if (Scont != ""  )
            {
                tt.Text = " 读取数据成功";

            }
            else
            {
                tt.Text = "没有搜索到相应内容";
            }
        }
        catch (Exception ex)
        {
            tt.Text = ex.Message;
        }
        
    }



    
        





    /// <summary>
    /// 格式化得到列表内容的正 则
    /// </summary>
    /// <param name="Xstr">传入的字符</param>
    /// <returns></returns>
    public string RegexStrX(string Xstr)
    {
        return Xstr.Replace("[内容列表]", @"[\W\w]+");
        
    }

    protected void Button1_ServerClick(object sender, EventArgs e)
    {

    }
}
